package org.example.managerserver.Service;

import org.example.managerserver.Entity.User;
import org.example.managerserver.Mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.List;

@Service
public class UserService {
    private final UserMapper userMapper;

    @Autowired
    public UserService(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public List<User> initialize(Integer pageNumber, Integer pageSize){
        return userMapper.initialize(pageNumber,pageSize);
    }

    public Integer totalNum(){
        return userMapper.totalNum();
    }

    public List<User> searchByOption(String optionSelect,String optionValue,Integer pageNumber, Integer pageSize){
        return userMapper.searchByOption(optionSelect,optionValue,pageNumber,pageSize);
    }

    public List<User> details(Integer id){
        return userMapper.details(id);
    }

    public Integer selectNum(String optionSelect,String optionValue){
        return userMapper.selectNum(optionSelect,optionValue);
    }

    public void addData(String username, String gender, String password, String nickname, String email, String createTime, String updateTime){
        userMapper.addData(username,gender,password,nickname,email,createTime,updateTime);
    }
    public void importData(String username,String gender,String password,String nickname,String email){
        userMapper.importData(username,gender,password,nickname,email);
    }

    public void updateData(Integer id,String username,String sex,String password,String nickname,String email,String updateTime){
        userMapper.updateData(id,username,sex,password,nickname,email,updateTime);
    }

    public void deleteData(Integer id){
        userMapper.deleteData(id);
    }



}
